MODULE LAPS_PARAMS

!==============================================================================
!doc  THIS ROUTINE DEFINES ALL PARAMETERS REQUIRED FOR LAPS.
!doc
!doc  HISTORY:
!doc	CREATION:	YUANFU XIE	MAY 2007
!doc    MODIFIED:       YUANFU XIE	MAR 2008 ADDING RADAR VARIABLES
!==============================================================================

  IMPLICIT NONE

  ! CONSTANTS:
  INTEGER,PARAMETER :: OUTPUT_CHANNEL=20,BFRTBL_CHANNEL=21,POINTS_CHANNEL=22
  ! FOR LAPSPLOT OF OBSERVATIONS:
  INTEGER,PARAMETER :: TMGOUT_CHANNEL=23,PIGOUT_CHANNEL=24,PRGOUT_CHANNEL=25,&
                       SAGOUT_CHANNEL=26
  REAL,PARAMETER :: INCHES_CONV2MM=2.54		! FROM INCH TO MILLI-METER

  ! BUFR encoding:
  CHARACTER*80, PARAMETER :: HEADER_PREBUFR= &
    'SID TYP T29 RPT DHR YOB XOB ELV ITP SQN PROCN'
  INTEGER,      PARAMETER :: HEADER_NUMITEM=11
  CHARACTER*80, PARAMETER :: OBSDAT_PREBUFR= &
    'ZOB POB TOB UOB VOB QOB PMO PRSS PWO'
  INTEGER,      PARAMETER :: OBSDAT_NUMITEM=9
  CHARACTER*80, PARAMETER :: OBSERR_PREBUFR= &
    'ZOE POE TOE WOE QOE PWE'
  INTEGER,      PARAMETER :: OBSERR_NUMITEM=6
  CHARACTER*80, PARAMETER :: OBSQMS_PREBUFR= &
    'ZQM PQM TQM WQM QQM PMQ PWQ'
  INTEGER,      PARAMETER :: OBSQMS_NUMITEM=7

  CHARACTER*80, PARAMETER :: SFCDAT_PREBUFR= &
    'PRSS ??? TOB ??? WDIR1 NWSPD1'
  INTEGER,      PARAMETER :: SFCDAT_NUMITEM=9
  CHARACTER*80, PARAMETER :: SFCERR_PREBUFR= &
   'SFCERR PREBUFR UNKNOWN'
  INTEGER,      PARAMETER :: SFCERR_NUMITEM=6
  CHARACTER*80, PARAMETER :: SFCQMS_PREBUFR= &
   'SFCQMS PREBUFR UNKNOWN'
  INTEGER,      PARAMETER :: SFCQMS_NUMITEM=7

  ! MISSING DATA:
  REAL*8,       PARAMETER :: MISSNG_PREBUFR=10.0E10

  ! REFERENCE VALUE FOR ICE/WATER RELATIVE HUMIDITY:
  REAL,         PARAMETER :: ABSOLU_TMPZERO=273.15
  REAL,         PARAMETER :: TEMPTR_REFEREN=-5.0 !-132.0

  ! GENERAL VARS:
  CHARACTER*8 :: FORMAT_REQUEST		! DATA FORMAT REQUESTED TO CONVERT TO
  CHARACTER*9 :: SYSTEM_ASCTIME 	! ASCII SYSTEM TIME
  CHARACTER   :: ANALYS_HOURCHA*2, &	! ANALYSIS HOUR
                 ANALYS_MINUTES*2, &	! ANALYSIS MINUTE
                 YYYEAR_JULIANS*5	! YY YEAR AND JULIAN DAYS
  CHARACTER   :: STRING_ASCTIME*16, &	! TIME IN A STRING
                 NUMBER_ASCTIME*14      ! TIME IN YYYYMMDDHHMM FORM
  INTEGER     :: NUMBER_GRIDPTS(4)	! NUMBER GRID POINTS IN X, Y, Z AND T
  INTEGER     :: LENGTH_ANATIME		! ANAL TIME WINDOW
  INTEGER     :: YYYYMM_DDHHMIN(5)	! TIME IN INTEGERS
  INTEGER     :: SYSTEM_IN4TIME		! I4 SYSTEM TIME
  INTEGER     :: RADARS_TIMETOL         ! RADAR TIME TOLERANCE
  INTEGER     :: IVALUE_MISSING		! MISSING VALUE IN INTEGER
  REAL        :: RVALUE_MISSING		! MISSING VALUE IN REAL
  REAL        :: SFCOBS_INVALID 	! BAD SURFACE OBSERVATION
  REAL        :: GRID4D_SPACING(4)	! GRID DISTANCE OF 4 DIMEMSION
  REAL, ALLOCATABLE, DIMENSION(:) :: &
		PRESSR_GRID1DM		! PRESSURE LEVELS
  REAL, ALLOCATABLE, DIMENSION(:,:) :: &
	        DOMAIN_LATITDE,        & ! GRID LATITUDES
		DOMAIN_LONGITD,        & ! GRID LONGITUDE
		DOMAIN_TOPOGRP           ! GRID TOPOGRAPHY
  REAL, ALLOCATABLE,DIMENSION(:,:,:) :: &
                HEIGHT_GRID3DM,&	! LAPS 3D HEIGHT BACKGROUND FIELD
                temptr_GRID3DM,&	! LAPS 3D HEIGHT BACKGROUND FIELD
                uuwind_GRID3DM,&	! LAPS 3D HEIGHT BACKGROUND FIELD
                vvwind_GRID3DM	! LAPS 3D HEIGHT BACKGROUND FIELD

  ! USE A NEW LAPS WIND PARAMETER SCHEME AND SO THE FOLLOWINGS ARE COVERED
  ! EXCEPT THOSE USED:

  ! FOR WIND DATA:
  ! LOGICAL     :: USEOBS_RAOBDAT	! USE RAOB DATA
  ! LOGICAL     :: USEOBS_CLDRFWD	! USE CLOUD DRIFT WIND
  ! LOGICAL     :: USEOBS_RADARWD	! USE RADIAL WIND
  ! INTEGER     :: THRESH_RADAROB(3)	! THRESHOLD NUMBERS DOPPLER OBS/LEVEL
					! BY FACTOR 2,4,9
  INTEGER     :: MAXNUM_PROFLRS	! MAX NUM PROFILERS
  INTEGER     :: MAXLVL_PROFLRS	! MAX LEVEL OF PROF

  INTEGER     :: MAXNUM_SONDES	! MAX NUM SONDES
  INTEGER     :: MAXLVL_SONDES 	! MAX LEVEL OF SONDES

  ! INTEGER     :: WEIGHT_OPTIONS	! LAPS WEIGHT SCHEME
  ! REAL        :: WEIGHT_BKGWIND	! WEIGHT FOR BACKGROUND WIND
  ! REAL        :: WEIGHT_RADARWD	! WEIGHT FOR RADAR WIND OBS
  ! REAL        :: THRESH_RMSWIND	! THRESHOLD FOR RMS FIT OF ANALYSIS TO
					! THE OBSERVATIONS

  ! NAME LIST FOR WIND:
  ! NAMELIST /WIND_NL/ USEOBS_RAOBDAT,USEOBS_CLDRFWD, &
  !		     USEOBS_RADARWD,THRESH_RADAROB, &
  !		     WEIGHT_BKGWIND,WEIGHT_RADARWD, &
  !		     THRESH_RMSWIND,MAXNUM_PROFLRS, &
  !		     MAXLVL_PROFLRS,WEIGHT_OPTIONS

END MODULE LAPS_PARAMS
